<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <script>
    window.addEventListener('resize', function () {
      console.log(document.body.clientWidth);
    });
  </script>
</body>
</html>